import request from '../utils/request'

// 登录接口
export const loginAPI = (email, password) => {
    return request.post('https://www.xinjianbk.xyz/login', {
        email: email,
        password: password
    })
}

// 获取邮箱验证码接口
export const emailCodeAPI = (email) => {
    return request.post('https://www.xinjianbk.xyz/email', {
        email: email
    })
}

// 注册接口
export const logonAPI = (email, userName, password, school, code) => {
    return request.post('https://www.xinjianbk.xyz/register', {
        email: email,
        username: userName,
        password: password,
        school: school,
        code: code
    })
}

// 修改密码
export const changePasswordAPI = (email, password, newPassword) => {
    return request.post('https://www.xinjianbk.xyz/EditLoginPassWord', {
        email: email,
        OldPass: password,
        NewPass: newPassword,
    })
}

// 获取用户信息
export const getUserAPI = (userID) => {
    return request.get('https://www.xinjianbk.xyz/getUserInfo', {
        params: {
            uid: userID
        }
    })
}

// 更新用户信息
export const updataUserAPI = (uid, username, value, school, name, qq, wx, phone, birthday) => {
    return request.post('https://www.xinjianbk.xyz/EditUserInfo', {
        uid: uid,
        username: username,
        sex: value,
        school: school,
        name: name,
        QQ: qq,
        wx: wx,
        phone: phone,
        birthday: birthday
    })
}

// 用户上传图像
export const upDataimgAPI = (file, uid) => {
    return request.post('https://www.xinjianbk.xyz/UploadHead', {
        file: file,
        uid: uid
    })
}

// 发布内容
export const contentAPI = (uid, content, value) => {
    return request.post('https://www.xinjianbk.xyz/publish', {
        uid: uid,
        content: content,
        cid: value,
    })
}

// 发布图片
export const sendImgAPI = (fileList) => {
    return request.post('https://www.xinjianbk.xyz/InsertImg', {
        file: fileList
    })
}

// 获取发布内容
export const getSendAPI = () => {
    return request.get('https://www.xinjianbk.xyz/getPublish')
}

// 获取内容详情(未用)
export const getDetailsAPI = () => {
    return request.get('https://www.xinjianbk.xyz/Details', {
        params: {
            // 发布内容id
            conid: ''
        }
    })
}

// 查询用户发布内容
export const getUsersendAPI = (uid) => {
    return request.get('https://www.xinjianbk.xyz/getUserRelease', {
        params: {
            uid: uid
        }
    })
}

// 获取分类
export const getClassAPI = () => {
    return request.get('https://www.xinjianbk.xyz/GetClass')
}

// 查询分类内容
export const getClassDataAPI = (cid) => {
    return request.get('https://www.xinjianbk.xyz/getClassData', {
        params: {
            cid: cid
        }
    })
}